package net.pulseproject.router.app;

import net.pulseproject.commons.gui.CommonsGuiGuiceModule;
import net.pulseproject.commons.midi.RouterMidiGuiceModule;
import net.pulseproject.commons.misc.CommonsMiscGuiceModule;
import net.pulseproject.router.app.misc.MainPresenter;
import net.pulseproject.router.app.misc.MainPresenterImpl;
import net.pulseproject.router.app.model.Model;
import net.pulseproject.router.app.view.MainMenuBar;
import net.pulseproject.router.app.view.MainMenuBarFactory;
import net.pulseproject.router.app.view.MainWindow;
import net.pulseproject.router.app.view.MainWindowImpl;
import net.pulseproject.router.app.view.PreferencesDialog;
import net.pulseproject.router.app.view.PreferencesDialogFactory;
import net.pulseproject.router.app.view.SoloPanel;
import net.pulseproject.router.app.view.SoloPanelFactory;
import net.pulseproject.router.config.RouterConfigGuiceModule;

import com.google.inject.AbstractModule;
import com.google.inject.Scopes;
import com.google.inject.assistedinject.FactoryProvider;

public class RouterAppGuiceModule extends AbstractModule {

	@Override
	protected final void configure() {
		install(new CommonsMiscGuiceModule());
		install(new CommonsGuiGuiceModule());
		install(new RouterMidiGuiceModule());
		install(new RouterConfigGuiceModule());
		
		this.bind(MainPresenter.class).to(MainPresenterImpl.class).in(Scopes.SINGLETON);
		this.bind(MainWindow.class).to(MainWindowImpl.class).in(Scopes.SINGLETON);
		this.bind(Model.class).toInstance(new Model());

		this.bind(PreferencesDialogFactory.class).toProvider(
			FactoryProvider.newFactory(PreferencesDialogFactory.class, PreferencesDialog.class));
		this.bind(SoloPanelFactory.class).toProvider(
			FactoryProvider.newFactory(SoloPanelFactory.class, SoloPanel.class));
		this.bind(MainMenuBarFactory.class).toProvider(
				FactoryProvider.newFactory(MainMenuBarFactory.class, MainMenuBar.class));
		
	}

}
